package com.merlin.meta.domain.common;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableAutoConfiguration
public class SwaggerConfig
{
  public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.merlin.meta.domain";//扫描路径
  public static final String SWAGGER_SERVICE_CNTITLE="元数据领域服务API接口";//标题
  public static final String SWAGGER_SERVICE_ENTITLE="meta domain service API interface";//英文标题
  public static final String TEAM_ENNAME ="meta team"; //团队英文名称
  public static final String TEAM_CNNAME ="元数据中心"; //团队名称
  public static final String VERSION = "0.0.1";//版本号
  
  
	@Bean
	public Docket api()
	{
		return new Docket(DocumentationType.SWAGGER_2).pathMapping("/").select()
				.apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
				//	      .paths(PathSelectors.ant("/emrapp/admin/*"))
				.build().apiInfo(apiInfo());
	}

	private ApiInfo apiInfo()
	{
		ApiInfo apiInfo = new ApiInfo(SWAGGER_SERVICE_CNTITLE, 
				SWAGGER_SERVICE_ENTITLE,
				VERSION, //版本
				TEAM_ENNAME, TEAM_CNNAME,
				"百度地址", //团队swagger
				"www.baidu.com"//团队swagger地址
		);

		return apiInfo;
	}

}